// 用流读取文件内容

let fs = require('fs');

let readable = fs.createReadStream('./working.txt').setEncoding('utf8');


let num = 0
let data = ''
readable.on('data', (chunk) => {
  console.log('chunk:', chunk)
  data += chunk
})

readable.on('end', () => {
  console.log('data:', data)
})

// copy

let writeable = fs.createWriteStream('./working2.txt')
readable.pipe(writeable)



